package com.huluobo.a2302mdmdemo.demo

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import com.huluobo.a2302mdmdemo.R

/**
 *  Created by LC on 2025/7/17.
 */

@Composable
fun MyImage() {
    Column {
        Image(
            modifier = Modifier.size(40.dp),
            painter = painterResource(id = R.drawable.ic_launcher_foreground),
            contentDescription = ""
        )
        Image(
            modifier = Modifier
                .size(100.dp)
                .background(Color.Blue),
            imageVector = Icons.Default.Favorite,
            contentDescription = ""
        )
        Image(
            modifier = Modifier
                .size(100.dp, 200.dp)
                .background(Color.Black),
            painter = painterResource(id = R.drawable.like),
            contentDescription = ""
        )

        AsyncImage(
            modifier = Modifier
                .size(300.dp)
                //背景,背景的形状
                .background(Color.Black, CircleShape)
                //图片的形状
                .clip(CircleShape),
            //图片内容的裁剪
            contentScale = ContentScale.Crop,
            model = "https://img1.baidu.com/it/u=4214113141,2036563917&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1729098000&t=0662d2b383091882ccdd43ad060de2a7",
            contentDescription = ""
        )
    }
}